const Timestamp = new Date().getTime()
const path = require('path')
const { defineConfig } = require('@vue/cli-service')
module.exports = defineConfig({
  transpileDependencies: true,
  //runtimeCompiler:true
  css: {
    loaderOptions: {
      less: {
        lessOptions: {
          modifyVars: {
            //这是配置css主题色
            'primary-color': '#1649ff',
          },
          javascriptEnabled: true,
        },
      },
    },
    // 每次打包后生成的css携带时间戳
    extract: {
      filename: `css/[name].${Timestamp}.css`,
      chunkFilename: `css/[name].${Timestamp}.css`,
    },
  },
  pluginOptions: {
    'style-resources-loader': {
      preProcessor: 'less',
      patterns: [
        // 全局变量路径，不能使用路径别名
        path.resolve(__dirname, './src/style/var.less'),
      ],
    },
  },
  productionSourceMap: false,
})
